package com.huanzhidadi.springsecurity.service.impl;

import com.alibaba.fastjson2.JSON;
import com.huanzhidadi.springsecurity.config.UserContextHolder;
import com.huanzhidadi.springsecurity.model.BaseResultVO;
import com.huanzhidadi.springsecurity.model.LoginUser;
import com.huanzhidadi.springsecurity.service.TestService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class TestServiceImpl implements TestService {
    @Override
    public BaseResultVO transUserSync() {
        LoginUser loginUser = UserContextHolder.currentLoginUser();
        log.info(JSON.toJSONString(loginUser));
        return BaseResultVO.success(loginUser);
    }

    @Override
    public BaseResultVO transUserAsync() {
        LoginUser loginUser = UserContextHolder.currentLoginUser();
        log.info(JSON.toJSONString(loginUser));
        return BaseResultVO.success(loginUser);
    }
}
